package com.yntx.usercenter.authentication.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DataShardingMapper {

    @Select("show tables like '${tableName}'")
    List<String> existsTable(@Param("tableName") String tableName);

    @Update("CREATE TABLE if not exists ${newTable} as select * from ${originalTable} where 1=2")
    void copyTables(@Param("originalTable") String originalTable, @Param("newTable") String newTable);

}